<cfscript>    
    view = createObject("component", session.rootDir & ".views.layout");
    if( Session.Auth EQ True and (Session.strAuthType EQ Session.MANAGERS or Session.strAuthType EQ Session.IT or Session.strAuthType EQ Session.HR) ){
        view.init("Disable User",
            "/jquery/ui-1.8.5/jquery-ui.min.js,/" & session.rootDir & "/static/js/SCF/disableuser.js",
            "/jquery/ui-1.8.5/themes/cupertino/jquery-ui.css","Home",main, "Termination");
    }else{
        view.init("Denied","","","Home","Denied");
    }
    view.html();
</cfscript>

<cffunction name="main" access="public" output="true" returntype="any">
    <cfscript>
        import models.*;
        //Rosettas = EntityLoad("RosettaStone", {Disabled = 0});
        Rosettas = ORMExecuteQuery("FROM RosettaStone WHERE Disabled = 0 ORDER BY UserAccount");
        Users = createObject("component", "#session.rootDir#.utilities.Users").init();
        AjaxController = '/#session.rootDir#/controller/AjaxHandler.cfm';
        FormAction = '/' & Session.RootDir & '/controller/SubmitHandlerTermination.cfm?DisableUser=disable';
    </cfscript>
    
    <cfoutput> 
        <h1 class="title">Disable User</h1>
        <div class="entry">
            Select a user from the drop down menu to disable.  The users AD account will be disabled, and the
            password will be scrambled.
            <br /><br />
        </div>
        
        <input type="hidden" value="#AjaxController#" id="AjaxController" />
        
        <cfform name="frmDisableUser">
            <table>
                <tr>
                    <td valign="top">
                        <strong>User Account:</strong>&nbsp;
                        <!---<cfset allUsers = Users.getAllADUsers() />--->
                        <cfselect name="UserAccount">
                            <option value="-1" selected="selected">-- Choose User Account --</option>
                            <cfloop from="1" to="#ArrayLen(Rosettas)#" index="i">
                                <option value="#Rosettas[i].getRosettaID()#">#Rosettas[i].getUserAccount()#</option>
                            </cfloop>                            
                        </cfselect>
                        <input type="hidden" id="FormAction" value="#FormAction#" />
                        <input type="button" id="DisableUser" value="Disable User"/>
                    </td>
                </tr>
            </table>
        </cfform>    
    </cfoutput>
    
</cffunction>